<div class='top' onmousedown='sortable()' >
  <div class='title'>
    <%= link_to_tool_by_setting @setting %>
  </div>
  <div class='supports'>
    <%= image_tag 'base/funcs/sms.png', :alt => '已经开通短信服务', :title => '已经开通短信服务' if @setting.allow_sms? %>
    <%= image_tag 'base/funcs/email.png', :alt => '已经开通邮件服务', :title => '已经开通短信服务' if @setting.allow_email? %>
  </div>
  <div class='tools'>
    <span id="portalet_<%= @setting.id %>_arrows" style='display:none;'>
      <%= link_to "←", "index", :class => :arrow %>
      <%= link_to "↑", "index", :class => :arrow %>
      <%= link_to "↓", "index", :class => :arrow %>
      <%= link_to "→", "index", :class => :arrow %>
    </span>
    <span class='h'>
      <%= link_to_remote "返回", 
            :update => "portalet_#{@setting.id}" ,
            :url => tools_weather_forecasts_url(:setting_id => @setting.id),
            :method => :get,
            :html => {
              :class => :h 
            }            
        %>
    </span>
  </div>
</div>
<div id='tool_<%= @setting.id %>_content' class='content'>
  <% remote_form_for "setting_#{@setting.id}",
       @setting,
       :update => "portalet_#{@setting.id}",
       :url => tools_weather_forecast_url(@setting),
       :method => :put,
       :html => {
         :id => "setting_form_#{@setting.id}"
       } do |f| %> 
    <dl>
      <dt>省份:</dt>
      <dd>
        <%= select_tag :province, 
              Province.all.collect{ |province|  "<option value='#{province.id}' #{province == @province ? 'selected':''}>#{province.name}</option>" }.to_s,
              :onchange => remote_function(
                :update => "setting_#{@setting.id}_city_id",
                :url => cities_url,
                :with => "'&province_id=' + this.value",
                :complete => (
                  remote_function(
                    :update => "setting_#{@setting.id}_area_id",
                    :url => areas_url,
                    :with => "'&city_id=' + $F('setting_#{@setting.id}_city_id')",
                    :method => :get
                  )
                ),
                :method => :get
              ) 
         %>
      </dd>
    </dl>                                    
    <dl>
      <dt>城市:</dt>
      <dd>
        <%= f.select :city_id, @province.cities.collect {|c| [ c.name, c.id ] }, {},
              :onchange => remote_function(
                :update => "setting_#{@setting.id}_area_id",
                :url => areas_url,
                :with => "'&city_id=' + this.value",
                :method => :get
              ) 
         %>
      </dd>
    </dl>
    <dl>
      <dt>城区:</dt>
      <dd>
        <%= f.select :area_id, @setting.area.city.areas.collect {|c| [ c.name, c.id ] } %>
      </dd>
    </dl>
    <dl>
      <dt>短信预报:</dt>
      <dd>
        <%= f.check_box :allow_sms,{ :class => 's no'},'yes','no' %><%= f.label :allow_sms, '开通' %>
        <%= link_to_add_fetion_if_setting_user_no_mobile @setting %>
      </dd>
    </dl>
    <dl>
      <dt>email预报:</dt>
      <dd>
        <%= f.check_box :allow_email,{:class => 's no'},'yes','no' %><%= f.label :allow_email, '开通' %>
      </dd>
    </dl>
    <dl>
      <dt>每日整点预报:</dt>
      <dd>
        <%= f.select :forecasted_hour,[
              ['0点',0],
              ['1点',1],
              ['2点',2],
              ['3点',3],
              ['4点',4],
              ['5点',5],
              ['6点',6],
              ['7点',7],
              ['8点',8],
              ['9点',9],
              ['10点',10],
              ['11点',11],
              ['12点',12],
              ['13点',13],
              ['14点',14],
              ['15点',15],
              ['16点',16],
              ['17点',17],
              ['18点',18],
              ['19点',19],
              ['20点',20],
              ['21点',21],
              ['22点',22],
              ['23点',23]
            ]  
         %>
      </dd>
    </dl>
    <dl>
      <dt>类型:</dt>
      <dd>
        <%= f.radio_button :date_type,'today' %><%= f.label :date_type_today, '今天' %>
        <%= f.radio_button :date_type,'tomorrow' %><%= f.label :date_type_tomorrow, '明天' %>
      </dd>
    </dl>    
  <% end %>
  <dl class='bottom'>
    <dd>
      <%= link_to_function "保存", "$('setting_form_#{@setting.id}').onsubmit()", :class => :submit %>
      <%= link_to_remote "重置",
            :update => "portalet_#{@setting.id}",
            :url => edit_tools_weather_forecast_url(@setting),
            :method => :get,
            :html => {
              :class => :reset
            } %>
      <%= link_to_remote  "返回", 
            :update => "portalet_#{@setting.id}",
            :url => tools_weather_forecasts_url(:setting_id => @setting.id),
            :method => :get,
            :success => "$('zhui').show()",
            :html => {
              :class => :return
            } %>
    </dd>
  </dl>
</div>